This post is all about the solution of the Minimum distance between 1s Starters 70 (Rated till 6-Stars) codechef problem solution.


Minimum distance between 1s Starters 70 (Rated till 6-Stars) codechef problem solution

Codechef 



AI based Love Calculator



Problem Statement:

Cook has a NN-length binary string SS. On the string, Cook can carry out the following operation:

Choose any substring of length 33 and reverse it.
Determine the shortest distance between any two 11s Chef can achieve by repeating the above procedure any (possibly infinite) number of times.

Note:
The separation between two main characters S iS I and S jS j is defined as abs(i-j)abs(ij).
There will be at least two occurrences of 11 in the string.
A substring is formed by removing some (possibly zero) elements from the string's beginning and some (possibly zero) elements from its end.

Format of Input :

The number of test cases will be indicated by a single integer TT on the first line of input.
Evey test case contains several lines of input.
Each test case's first line contains an integer NN indicating the number of characters in the string.
The following line contains a binary string with length NN.

Format of the Output :

For every test case, print the shortest distance between any two 11s Chef can achieve by repeating the above operation any (possibly infinite) amount of times.


AI based Love Calculator




Also Check this out:-

Spice Level Starters 70 (Rated till 6-Stars) codechef problem solution, Click Here
Cost of Groceries Starters 70 (Rated till 6-Stars) codechef problem solution, Click Here
Prime Reversal Starters 70 (Rated till 6-Stars) codechef problem solution, Click Here

Solution of the Problem: Click Here